From: Eli Zaretskii Date: Mon, 18 Feb 2013 16:38:50 +0000 (+0200) Subject: Avoid leaking handles on MS-Windows. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~844^2~6^2~93^2~4 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=17ddfd150ff1d84021342ee82ff53b5860579252;p=emacs.git Avoid leaking handles on MS-Windows. src/w32proc.c (new_child): Avoid leaking handles if the subprocess resources were not orderly released. --- diff --git a/src/ChangeLog b/src/ChangeLog index 4325d35adee..99b5e8734e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-02-18 Eli Zaretskii + + * w32proc.c (new_child): Avoid leaking handles if the subprocess + resources were not orderly released. + 2013-02-17 Eli Zaretskii * w32proc.c (new_child): Remove the loop that attempted to salvage diff --git a/src/w32proc.c b/src/w32proc.c index 3b4522bf16b..da4549bd7df 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -802,6 +802,12 @@ new_child (void) cp = &child_procs[child_proc_count++]; Initialize: + /* Last opportunity to avoid leaking handles before we forget them + for good. */ + if (cp->procinfo.hProcess) + CloseHandle (cp->procinfo.hProcess); + if (cp->procinfo.hThread) + CloseHandle (cp->procinfo.hThread); memset (cp, 0, sizeof (*cp)); cp->fd = -1; cp->pid = -1;